package com.scopionstudio.housemusic.adapter;

import java.util.ArrayList;
import com.scopionstudio.housemusic.R;
import com.scopionstudio.housemusic.data.objData;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class MusicAdapter extends ArrayAdapter<objData>{
	Context mContext;
	int row;
	ArrayList<objData> listItems;
	objData obj;
	public MusicAdapter(Context context, int textViewResourceId,
			ArrayList<objData> objects) {
		super(context, textViewResourceId, objects);
		this.mContext=context;
		this.row=textViewResourceId;
		this.listItems=objects;
	}
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		obj=listItems.get(position);
		ViewHolder holder;
		LayoutInflater inflate=(LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View v=convertView;
		if(v==null){
			holder=new ViewHolder();
			v=inflate.inflate(R.layout.row_list_music, null);
			holder.txtName=(TextView) v.findViewById(R.id.txtNameMusic);
			v.setTag(holder);
			
		}
		else{
			holder=(ViewHolder) v.getTag();
		}
		holder.txtName.setText(obj.getName());
		
		return v;
		
	}
class ViewHolder{
	TextView txtName;
	
}


}
